package com.atgg;

import com.atgg.beans.Person;
import com.atgg.config.MainCofig;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class MainTest {
    public static void main(String[] args) {

//        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("beans.xml");
//        Person bean = (Person) applicationContext.getBean("person");

        ApplicationContext context = new AnnotationConfigApplicationContext(MainCofig.class);
        Person person = (Person) context.getBean("iflytek");
        System.out.println(person);
        String[] names = context.getBeanNamesForType(Person.class);
        for (String name :
                names) {
            System.out.println(name);
        }
    }
}
